using Lily.TestHelper;
using Lily.TestHelper.UI;
using Lily.TestHelper.White;
using NUnit.Framework;

namespace Lily.Example.Tests
{
	public class UiTestBase
	{
		protected IWindowDriver Window;
		private WhiteApplicationDriver _appDriver;
		private string _DefaultWindowName;
		private const string path = @"..\..\..\Lily.Example.Forms\bin\Debug\Lily.Example.Forms.exe";  // :(

		[SetUp]
		public void FixtureSetup()
		{
			_appDriver = new WhiteApplicationDriver(path);
			_DefaultWindowName = "White Hello World";
			Window = _appDriver.SelectWindowDriver(_DefaultWindowName);

			InputTesterFactory.Default = () => new InputWrapperFactoryOverride();
			MultipleInputTesterFactory.Default = () => new MultipleInputFactoryOverride();

		}

		public InputForm<T> Form<T>(string windowName)
		{
			Window = _appDriver.SelectWindowDriver(windowName);
			return new InputForm<T>(Window);
		}

		[TearDown]
		public void teardown()
		{
			_appDriver.Dispose();
			Window = null;
		}

	}
}